#ifndef ut_convert_H
#define ut_convert_H
#include "ut_bstream.h"

class utconvert_base
{
public:
	virtual void tostream(utOStream& s,void* v)=0;
	virtual void fromstream(utIStream& s,void* v)=0;
	virtual void tostream(utOStreamNet& s,void* v)=0;
	virtual void fromstream(utIStreamNet& s,void* v)=0;
};
template<typename T>
class utconvert:public utconvert_base
{
public:
	virtual void tostream(utOStream& s,void* v)
	{
		s<<*(T*)(v);
	}
	virtual void fromstream(utIStream& s,void* v)
	{
		s>>*(T*)(v);
	}
	virtual void tostream(utOStreamNet& s,void* v)
	{
		s<<*(T*)(v);
	}
	virtual void fromstream(utIStreamNet& s,void* v)
	{
		s>>*(T*)(v);
	}
};




#endif